#!/bin/bash
day=$1
if [ -z $day ]; then
    day=`date -d last-day +%Y%m%d`
fi

initday=20161000

#for ((i = 2; i < 19; i++))
#do
#    day=$[initday+i]
mergeDir=merge_dmarket_access_log
statDir=stat_url_visit_count
cat ${mergeDir}/${day}-dmarket_access_log | grep "normal\|transitional" | awk -F\" '{print $2}' | awk -F " " '{print $2}' | awk -F \? '{print $2}' | awk -F \= '{print $2}' | awk -F \& '{print $1}' | sort | uniq -c | sort -n >> $statDir/$day-url-stat
#cat ${mergeDir}/${day}-dmarket_access_log | grep transitional | awk -F\" '{print $2}' | awk -F " " '{print $2}' | awk -F \? '{print $2}' | awk -F \= '{print $2}' | awk -F \& '{print $1}' | sort | uniq -c | sort -n >> $statDir/$day-url-stat
#cat ${mergeDir}/${day}-dmarket_access_log | grep "transitional\|normal" | awk -F\" '{print $2}' | awk -F " " '{print $2}' | awk -F \? '{print $2}' > $statDir/$day-url
#done
